package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Phone     string `gorm:"type:char(11);not null;comment:手机号"`
	Password  string `gorm:"varchar(50);noe null;comment:密码"`
	Nickname  string `gorm:"varchar(30);not null;comment:昵称"`
	AvatarUrl string `gorm:"varchar(500);not null;comment:头像"`
	Status    int    `gorm:"type:tinyint(5);default:0;comment:账号状态"`
}

type Course struct {
	gorm.Model
	Title         string  `gorm:"type:varchar(50);not null;comment:课程标题"`
	UserId        int     `gorm:"type:int;not null;comment:讲师ID"`
	Category      string  `gorm:"type:varchar(20);not null;comment:课程分类"`
	Price         float64 `gorm:"type:decimal(10,2);not null;comment:课程价格"`
	OriginalPrice float64 `gorm:"type:decimal(10,2);not null;comment:原价"`
	CoverUrl      string  `gorm:"varchar(500);not null;comment:课程封面"`
	Intro         string  `gorm:"varchar(500);not null;comment:课程简介"`
	LearnCount    int     `gorm:"type:int;default:0;comment:学习人数"`
	Status        int     `gorm:"type:tinyint(5);default:0;comment:课程状态"`
}

type Teacher struct {
	gorm.Model
	Name      string `gorm:"type:varchar(30);not null;comment:讲师姓名"`
	Intro     string `gorm:"varchar(500);not null;comment:讲师简介"`
	AvatarUrl string `gorm:"varchar(500);not null;comment:讲师头像"`
}

type Evaluation struct {
	gorm.Model
	CourseId    int    `gorm:"type:int;not null;comment:课程ID"`
	UserId      int    `gorm:"type:int;not null;comment:用户ID"`
	Score       int    `gorm:"type:tinyint(5);default:0;comment:评分"`
	Content     string `gorm:"varchar(500);not null;comment:评论内容"`
	IsAnonymous int    `gorm:"type:tinyint(5);default:0;comment:是否匿名"`
	Status      int    `gorm:"type:tinyint(5);default:0;comment:评价状态"`
}

type Collection struct {
	gorm.Model
	UserId   int `gorm:"type:int;not null;comment:用户ID"`
	CourseId int `gorm:"type:int;not null;comment:课程ID"`
	Status   int `gorm:"type:tinyint(5);default:0;comment:收藏状态"`
}

type CourseData struct {
	Course
	Nickname string
}

type CollectData struct {
	Title      string
	Nickname   string
	LearnCount int64
}

type EvalData struct {
	Evaluation
	Nickname string
}
